# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=wpaperd
pkgver=0.3.0
pkgrel=2
pkgdesc="Wallpaper daemon for Wayland"
url="https://github.com/danyspin97/wpaperd"
license="GPL-3.0-or-later"
arch="all !s390x !riscv64" # blocked by rust/cargo
makedepends="cargo libxkbcommon-dev scdoc cargo-auditable"
subpackages="
	$pkgname-doc
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="https://github.com/danyspin97/wpaperd/archive/$pkgver/wpaperd-$pkgver.tar.gz
	cargo-lock.patch
	"
options="!check" # no test suite


prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --frozen --release

	scdoc <man/wpaperd-output.5.scd >man/wpaperd-output.5
}

package() {
	install -Dm755 target/release/$pkgname -t "$pkgdir"/usr/bin/

	install -Dm644 man/*.1 -t "$pkgdir"/usr/share/man/man1/
	install -Dm644 man/*.5 -t "$pkgdir"/usr/share/man/man5/

	install -Dm644 completions/$pkgname.bash \
		"$pkgdir"/usr/share/bash-completion/completions/$pkgname
	install -Dm644 completions/$pkgname.fish \
		"$pkgdir"/usr/share/fish/vendor_completions.d/$pkgname.fish
	install -Dm644 completions/_$pkgname \
		"$pkgdir"/usr/share/zsh/site-functions/_$pkgname
}

sha512sums="
8fa4136e503e76f5c9b0cabe8679dedf6997f8fd6d0348f19743bfc7dfda2e3360e2ede3353539ada785816d07ac97fbc2b932c4cab76b06ed9db639be03af6a  wpaperd-0.3.0.tar.gz
8d8d5ce658f9ca48064ba1037669c775807eb4d8d7651551f97c5b386e910820c484c1b0d6a7740e8ccd672431bf9bc8759d72b763ac3b4e9a066507ed628604  cargo-lock.patch
"
